package cn.edu.scau.cmi.wujiaxian.exercise4;

public class Xiti7 {
	
	public static void main(String[] args) {
		int sum = 0;
		int i = 1;
		while (sum <= 9876) {
			sum += Factorial(i++);
		}
		System.out.println(i - 1);
	}
	
	
	public static int Factorial(int n) {
		if (n <= 1) return 1;
		else return Factorial(n - 1) * n; 
	}
	
}
